1. Field of the Invention
The present disclosure generally relates to techniques for operating an electronic device comprising at least a central processing unit on the basis of platform independent software, wherein the platform is provided by a virtual machine that simulates a standard hardware environment.
2. Description of the Related Art
The continuous advance in the field of semiconductor manufacturing resulted in the fabrication of fast and powerful integrated circuits, which may include millions of individual transistor elements. Consequently, highly complex digital circuitry has been developed and used for designing and producing sophisticated central processing units (CPUs), wherein increased packing density in combination with reduced power consumption and high internal storage capacity has fueled a plurality of developments in integrating sophisticated CPUs into a wide variety of electronic devices. Consequently, not only computer systems may have superior performance with respect to operating speed and power consumption, but also a variety of other electronic devices, such as mobile devices in the form of handheld computers, mobile phones and the like, may provide remarkable computational resources. Consequently, with the immense increase of computer systems and other electronic devices, the corresponding demand for sophisticated application has been created and still exists.
Typically, a CPU may be operated on the basis of a dedicated byte code or machine code, which may result in a corresponding change of state of hardware components, such as registers, I/O (input/output) terminals and the like, in accordance with the sequence of machine code instructions. Thus, at the deepest level of a communication between a user application and the hardware system including the CPU, the corresponding sequence of byte code instructions has to be executed by the CPU, thereby providing the desired results in the form of register contents and the like. However, the development of a corresponding more or less complex sequence of machine code instructions may be extremely time consuming and may also require specific skills in “translating” a corresponding problem or object to be solved by a specified application into a sequence of machine code instructions. Moreover, development of a machine code program appropriate for meeting the requirements of a specified application depend strongly on the configuration of the hardware system used, i.e., the specific CPU in combination with other components, such as external working memory, bus configurations and the like, so that a machine code program provided for a specific hardware configuration may not work with a different hardware system. For these reasons, programming languages have been developed to facilitate the communication between the program developer and the hardware system in which the corresponding application has to be executed. For example, the introduction of assembler languages presented a significant advance to provide and set a higher level of abstraction compared to the basic machine byte code. In further attempts for increasing the level of abstraction, higher programming languages have been developed to provide an appropriate platform for generating source code corresponding to a specific application, which may be translated into a corresponding machine byte code that is understandable and thus executable by the microprocessor of the computer system. In these high level programming languages, certain key words have to be used according to a language specific “grammar,” thereby allowing defining a sequence of program steps to obtain the required results.
According to one approach in developing high level programming languages, so-called object oriented programming has become a frequently used technique, in which it is attempted to map everyday life situations more conveniently into a computer program. That is, according to the object oriented approach, specific objects or classes may be defined so as to have basic features which may respond to certain events in a predefined manner. In this way, very complex applications may be created, wherein respective objects may repeatedly be used in different applications in a very convenient manner, thereby avoiding the repeated development of the same software.
Although high level programming languages may provide a convenient platform for developing a plurality of applications, the wide variety of available hardware platforms, i.e., different microprocessor types, computer system architectures and the like, may nevertheless require a specific adaptation of the applications to the target architecture. Due to this situation, languages have been developed in view of providing the possibility of developing platform independent applications, in which the software developer may focus on the application itself without having to take into consideration hardware specific characteristics of corresponding computer systems. The demand for platform independent applications may further be driven by the fact that a variety of computer based electronic devices are nowadays available which provide computational resources that may allow the deployment of a plurality of applications. Since electronic devices such as mobile phones, handheld computers and the like may differ significantly from each other in their hardware configuration, a platform independent application would therefore allow the development of applications which may finally be used in any type of electronic device, irrespective of the specific hardware architecture.
Moreover, a steadily increasing amount of computer systems may be connectable by any appropriate network, such as the internet, based on wireless and cable based network channels so that applications may be conveyed to a user via the network, wherein the hardware configuration of a specific target system may not be known in advance.
The concept of providing platform independent applications is actually based on the introduction of a “virtual” computer system or virtual machine which may be operated on a specific virtual byte code that is provided by the platform independent application. Thus, the virtual machine actually simulates a hardware configuration and thus acts as an interface between the platform independent application and the specific hardware configuration. Thus, a plurality of virtual machines may be available that provide the standard platform for executing “platform independent” applications while interfacing with dedicated hardware configurations in combination with associated operating systems. Consequently, when an appropriate virtual machine is installed in a computer system, or any other electronic device, an application may be developed and may be executed by the virtual machine independent of the hardware configuration. For example, the programming language JAVA of Sun Microsystems represents an object oriented language in which applications may be efficiently programmed without requiring an adaptation to different operating systems of the specific computer platforms. If a user starts a JAVA program, the JAVA virtual machine is automatically started and loads corresponding class files, which may then be interpreted to generate the “machine code” of the virtual machine. If further classes may be required for performing the application under consideration, these classes may be loaded on demand during run time and may also be interpreted as required. For example, many classes are available for the virtual machine and may be implemented in a corresponding library. Thus, during operation of the virtual machine, the actual CPU executes the machine code corresponding to the virtual machine thereby requiring memory for storing the state of the processor, for instance in the form of IRQ (interrupt request) addresses and the like. Hence, the processor, the machine code and the state memory define the virtual machine. On the other hand, the virtual machine executes the application corresponding to the compiled program of the application thereby also requiring a dedicated state memory in which any specific information of the virtual machine may be stored. For example, a table of each version of classes that simultaneously exists in the virtual machine may be stored. The virtual machine, the program loaded therein and the respective virtual specific state memory thus realize the actual application. For example, in the JAVA virtual machine specifications, the format of any input is specified, i.e., the class files, and it is also specified how to interpret the class files. However, as previously explained, it is not explicitly specified how to implement the interpretation. Consequently, an independently operating platform system is provided so that it is not relevant for the JAVA application whether it is executed on a LINUX system, a Windows system or any other type of operating system, as long as a dedicated virtual machine is installed for any of these platforms.
The desired platform independent functionality of JAVA applications is realized in the following manner. The input for the JAVA virtual machine or class files may contain any information about the desired application. The class files have a specific structure which is realized by a plurality of sections which contain required information, such as constant pool entries, method and field descriptions, code and debug information and the like. Consequently, upon loading and interpreting a corresponding class file, the information contained in these standard sections may be used for verifying and preparing the class file for being executed by the virtual machine.
Basically, a class may be understood as representation of a plurality of similar objects which may have attributes and methods. An attribute may be considered as a constant or a variable having a specific type. A method may be understood as a “function” which may thus represent a sequence of process steps represented by a table of byte codes, i.e., machine instructions of the virtual machine that have to be executed in order to define a specified program sequence. The byte code of the virtual machine may represent a similar level of abstraction as an assembler instruction, previously explained. Thus, for each method, corresponding local variables may have to be stored in combination with additional information with respect to the maximum amount of memory space required and the like. In addition, due to the object oriented nature of the language, classes may inherit methods and attributes from other classes, which may also have to be stored in the standard sections of the class under consideration. In addition, security information and information for exception handling and debugging has to be provided within the standard sections. Moreover, the virtual machine comprises a class loader that is responsible for “converting” the class information externally stored in class files into run time structures. For this purpose, the class loader may verify the consistency of the class under consideration, for instance in view of verifying that each part of the file is accessible via the program and the like. When the verification is completed without identifying any errors, the class loader loads the information into the virtual machine and initiates the byte code executor of the virtual machine. The virtual machine executor is responsible for executing methods on the basis of byte codes, as described above. If an instruction for generating a version of a respective class is encountered, the byte code executing unit detects whether or not this class has already been loaded. Consequently, corresponding class files may be loaded into the virtual machine upon request during run time, where corresponding class files may be provided by any appropriate source, such as a local storage of the platform under consideration, a remote computer and the like.
Although the feature of independence of the virtual machine from any specific operating system and hardware configuration is highly advantageous for a plurality of applications, it may nevertheless be advantageous to incorporate platform specific “methods” so as to use specific characteristics of the platform, thereby enhancing performance of a respective application, reducing efforts in terms of time for developing specific applications and the like. In this case, the class file may include a reference to a “native method,” which is to be understood as a platform specific set of instructions appropriate for performing a certain sequence of program steps with high efficiency on the basis of platform internal resources. Corresponding native methods may typically be provided in the form of appropriate libraries, such as dynamic link libraries (DLL) used in the operating system Windows, or in so-called shared libraries, for instance used in the operating system LINUX. Upon referencing a corresponding request for a native method, the corresponding library required for servicing the request may have been appropriately “packaged” by the user so that the required libraries are in the application's library path at run time of the application in order to avoid a corresponding run time error when the requested library is not available. Furthermore, frequently, a conflict may occur when different versions of classes require different versions of the native code representing a corresponding native method, which may have to be provided by different native code libraries. In this case, frequently, each version of the class may resolve its request for the native method via the same library path which may thus also result in a corresponding run time error. Consequently, the deployment of a JAVA application requiring the incorporation of native methods may be tedious and error prone, thereby making this approach, i.e., the usage of platform internal resources, less attractive.
In view of the situation described above, the present disclosure relates to systems and methods in which native methods may be efficiently used in an otherwise platform independent application, while avoiding or at least reducing the effects of one or more of the problems identified above.